package com.dog.basics.api.controller.common;



import com.dog.basics.bean.vo.api.common.AllPositioninfoVo;
import com.dog.basics.bean.vo.api.common.PositioninfoVo;
import com.dog.basics.common.constant.SwaggerConstants;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.IDogComPositioninfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * <p>
 * 省市区信息 前端控制器
 * </p>
 *
 * @author zmr
 * @since 2020-05-27
 */
@RestController
@RequestMapping("/api/positioninfo")
@Api(value = "省市区信息模块", tags = SwaggerConstants.API_ALL)
@AllArgsConstructor
public class DogComPositioninfoController {
    private final IDogComPositioninfoService dogComPositioninfoService;

    /**
     * @Description: 全国省市区信息
     * @Param:
     * @return:
     * @Author: zhangmr
     * @Date:
     */
    @ApiOperation(value = "全国省市区信息", notes = "全国省市区信息", tags = SwaggerConstants.API_UTIL)
    @GetMapping("/allPositioninfo")
    public R<AllPositioninfoVo> page() {
        return R.ok(dogComPositioninfoService.getAllPositioninfo());
    }


    /**
     * @Description: 通过父ID获取子省市区信息
     * @Param:
     * @return:
     * @Author: zhangmr
     * @Date:
     */
    @ApiOperation(value = "通过父ID获取子省市区信息", notes = "通过父ID获取子省市区信息", tags = SwaggerConstants.API_UTIL)
    @ApiImplicitParam(name = "id", value = "省市区标识", required = true, dataType = "Long", paramType = "query")
    @GetMapping("/positioninfo/{id}")
    public R<List<PositioninfoVo>> getPositioninfo(@PathVariable("id")  Long id) {
        return R.ok(dogComPositioninfoService.getPositioninfo(id));
    }


}
